import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';

export declare type Option = {
  value: number;
  label: string;
};
@Component({
  selector: 'el-pagination-size',
  templateUrl: './size.component.html'
})
export class SizeComponent implements OnInit {
  @Input() model: number = 1;
  @Input() sizes: Array<number> = [];
  @Output() modelChange: EventEmitter<number> = new EventEmitter();
  @Input() options: Option[] = [];
  constructor() { }

  ngOnInit(): void {
    this.options = this.sizes.map(function (size) {
      return ({
        value: size,
        label: size + '条/页',
      });
    });
  }


  handleChange(event:any) {
    this.modelChange.emit(event);
  }

  // handleChange(event:Event) {
  //   var val = (event.target as any).value;
  //   this.modelChange.emit(val);
  // }
}
